import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

# 创建示例数据
x = np.linspace(-5, 5, 50)
y = np.linspace(-5, 5, 50)
z = 2*x

# 创建3D图形
fig = plt.figure(figsize=(10, 8))
ax = fig.add_subplot(111, projection='3d')
ax.plot3D(x, y, z, 'green')

# 添加坐标轴标签
ax.set_xlabel('X轴', fontsize=12, labelpad=10)
ax.set_ylabel('Y轴', fontsize=12, labelpad=10)
ax.set_zlabel('Z轴', fontsize=12, labelpad=10)
# 设置标题
ax.set_title('3D曲面图示例', fontsize=14, pad=20)

# 调整视角
ax.view_init(elev=30, azim=45)

plt.tight_layout()
plt.show()